"""
Author: Morphlng
Date: 2024-03-18 14:42:17
LastEditTime: 2024-03-21 10:52:10
LastEditors: Morphlng
Description: The base class for all scenarios
FilePath: /DrivingGym/src/driving_gym/environment/scenario/base_scenario.py
"""

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from driving_gym.simulation.adapter_interface import AdapterInterface


class BaseScenario:
    def __init__(self, config: dict, adapter: "AdapterInterface"):
        """Base class for all scenarios

        Note: we pass adapter here because some scenarios may need to interact with the simulator
        """
        self.config = config
        self.adapter = adapter

        self.max_steps = config.get("max_steps", 500)

    def get_actor_config(self, actor_id):
        return self.config["actor"][actor_id]

    def get_task(self, actor_id):
        return self.config["task"][actor_id]

    def reset(self):
        self.adapter.load_scenario(self.config)

    def run_step(self):
        pass
